package com.bytecat.algui.service;

import static android.os.Process.killProcess;
import static android.os.Process.myPid;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;

import com.bytecat.algui.AlguiHacker.AlguiNativeMemTool;
import com.bytecat.algui.ICommandService;
public class HostService extends Service {
    private final ICommandService.Stub binder = new ICommandService.Stub() {
        @Override
        public int getPid() {
            return myPid();
        }
        @Override
        public int getAidlPid()  {
            return -1;
        }
        @Override
        public boolean isAidlConnectApp()  {
            return false;
        }
        @Override
        public void killSelf(boolean onlyMainProcess) throws RemoteException {
            killProcess(myPid());
        }
        @Override
        public void bindAidlToApp()  {}



        @Override
        public String test() throws RemoteException {
            return AlguiNativeMemTool.test();
        }
        @Override
        public void setIsSecureWrites(boolean sw)  {
            AlguiNativeMemTool.setIsSecureWrites(sw);
        }
        @Override
        public long getModuleBaseAddr(String moduleName, int headType)  {
            return AlguiNativeMemTool.getModuleBaseAddr(moduleName,headType);
        }
        @Override
        public long jump(long addr, int count)  {
            return AlguiNativeMemTool.jump(addr,count);
        }
        @Override
        public long jump32(long addr)  {
            return AlguiNativeMemTool.jump32(addr);
        }
        @Override
        public long jump64(long addr)  {
            return AlguiNativeMemTool.jump64(addr);
        }
        @Override
        public int setMemoryAddrValue(String value, long addr, int type, boolean isFree)  {
            return AlguiNativeMemTool.setMemoryAddrValue(value,addr,type,isFree);
        }
        @Override
        public String getMemoryAddrData(long addr, int type)  {
            return AlguiNativeMemTool.getMemoryAddrData(addr,type);
        }
        @Override
        public int getDword(long addr)  {
            return AlguiNativeMemTool.getDword(addr);
        }
        @Override
        public float getFloat(long addr)  {
        return AlguiNativeMemTool.getFloat(addr);
        }
        @Override
        public double getDouble(long addr)  {
            return AlguiNativeMemTool.getDouble(addr);
        }
        @Override
        public long getQword(long addr)  {
            return AlguiNativeMemTool.getQword(addr);
        }
        @Override
        public int getWord(long addr)  {
            return AlguiNativeMemTool.getWord(addr);
        }
        @Override
        public byte getByte(long addr)  {
            return AlguiNativeMemTool.getByte(addr);
        }
        @Override
        public String getString(long addr)  {
            return AlguiNativeMemTool.getString(addr);
        }
        @Override
        public int getDword_t(long addr)  {
            return AlguiNativeMemTool.getDword_t(addr);
        }
        @Override
        public float getFloat_t(long addr)  {
            return AlguiNativeMemTool.getFloat_t(addr);
        }
        @Override
        public double getDouble_t(long addr)  {
            return AlguiNativeMemTool.getDouble_t(addr);
        }
        @Override
        public long getQword_t(long addr)  {
            return AlguiNativeMemTool.getQword_t(addr);
        }
        @Override
        public int getWord_t(long addr)  {
            return AlguiNativeMemTool.getWord_t(addr);
        }
        @Override
        public byte getByte_t(long addr)  {
            return AlguiNativeMemTool.getByte_t(addr);
        }
        @Override
        public String getString_t(long startAddr)  {
            return AlguiNativeMemTool.getString_t(startAddr);
        }
        @Override
        public void setMemoryArea(int memoryArea)  {
            AlguiNativeMemTool.setMemoryArea(memoryArea);
        }
        @Override
        public long[] MemorySearch(String value, int type)  {
            return AlguiNativeMemTool.MemorySearch(value,type);
        }
        @Override
        public long[] MemorySearchRange(String value, int type)  {
            return AlguiNativeMemTool.MemorySearchRange(value,type);
        }
        @Override
        public long[] MemorySearchUnited(String value, int type)  {
            return AlguiNativeMemTool.MemorySearchUnited(value,type);
        }
        @Override
        public long[] ImproveOffset(String value, int type, long offset)  {
            return AlguiNativeMemTool.ImproveOffset(value,type,offset);
        }
        @Override
        public long[] ImproveOffsetRange(String value, int type, long offset)  {
            return AlguiNativeMemTool.ImproveOffsetRange(value,type,offset);
        }
        @Override
        public long[] ImproveOffsetUnited(String value, int type, long offset)  {
            return AlguiNativeMemTool.ImproveOffsetUnited(value,type,offset);
        }
        @Override
        public long[] ImproveValue(String value, int type)  {
            return AlguiNativeMemTool.ImproveValue(value,type);
        }
        @Override
        public int MemoryOffsetWrite(String value, int type, long offset, boolean isFree)  {
            return AlguiNativeMemTool.MemoryOffsetWrite(value,type,offset,isFree);
        }
        @Override
        public int getResultCount()  {
            return AlguiNativeMemTool.getResultCount();
        }
        @Override
        public long[] getResultList()  {
            return AlguiNativeMemTool.getResultList();
        }
        @Override
        public int printResultListToFile(String filePath)  {
            return AlguiNativeMemTool.printResultListToFile(filePath);
        }
        @Override
        public int clearResultList()  {
            return AlguiNativeMemTool.clearResultList();
        }
        @Override
        public void setFreezeDelayMs(int delay)  {
             AlguiNativeMemTool.setFreezeDelayMs(delay);
        }
        @Override
        public int getFreezeNum()  {
            return AlguiNativeMemTool.getFreezeNum();
        }
        @Override
        public int addFreezeItem(String value, long addr, int type)  {
            return AlguiNativeMemTool.addFreezeItem(value,addr,type);
        }
        @Override
        public int removeFreezeItem(long addr)  {
            return AlguiNativeMemTool.removeFreezeItem(addr);
        }
        @Override
        public int removeAllFreezeItem()  {
            return AlguiNativeMemTool.removeAllFreezeItem();
        }
        @Override
        public int startAllFreeze()  {
            return AlguiNativeMemTool.startAllFreeze();
        }
        @Override
        public int stopAllFreeze()  {
            return AlguiNativeMemTool.stopAllFreeze();
        }
        @Override
        public String getMemoryAddrMapLine(long address)  {
            return AlguiNativeMemTool.getMemoryAddrMapLine(address);
        }
        @Override
        public String getMapLineMemoryAreaName(String mapLine)  {
            return AlguiNativeMemTool.getMapLineMemoryAreaName(mapLine);
        }
        @Override
        public String getMemoryAreaIdName(int memid)  {
            return AlguiNativeMemTool.getMemoryAreaIdName(memid);
        }
        @Override
        public String getMemoryAreaName()  {
            return AlguiNativeMemTool.getMemoryAreaName();
        }
        @Override
        public String getDataTypeName(int typeId)  {
            return AlguiNativeMemTool.getDataTypeName(typeId);
        }
    };
    @Override
    public IBinder onBind(Intent intent) {
        return binder;
    }
}
